
package main
import (
	"fmt"
	"sync"
	"time"
)

type Task func()

type TaskResult struct{
	taskId int,
	startTime time.Time,
	endTime time.Time,
	duration time.Duration
}

type Scheduler struct{
	tasks []Task,
	results []TaskResult,
	wg sync.WaitGroup,
	startTime time.Time
}


func createScheduler(tasks []Task) *Scheduler {
	return & Scheduler(
		tasks: tasks,
		results: make([]TaskResult, len(tasks))
	)
}

func (s *Scheduler) execTask(taskId int, task Task){
	start:= time.Now()
	task()
	end:= time.Now()

	s.results[taskId] := TaskResult{
		taskId: taskId,
		startTime: start,
		endTime: end,
		duration: end.Sub(start)
	}
}

func (s *Scheduler) printResult(){

}

func (s *Scheduler) run(){
	s.startTime = time.Now()
	for i, task := range s.tasks {
		s.wg.add(1)
		s.execTask(i, task)
	}
	s.wg.Wait()
}


func main(){
	tasks := []Task{
		func (){
			//
		}
	}

	s:=createScheduler(tasks)
	s.run()
	s.printResult()
}
